'''
一个简单的应用
'''
 
import sys
import os
import tkinter as tk # 导入tkinter
from PIL import Image, ImageTk
from pathlib import Path
# from utils.image import load_and_resize_image

print(os.path.dirname(os.path.abspath(__file__)))
# 把当前文件所在文件夹的父文件夹路径加入到PYTHONPATH
# sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from constants import *
# from utils_liiiii import *
 
root = tk.Tk() # 创建窗口
root.title("我的应用程序") # 更改标题
 
# 设置 Label 的最大大小，百分比缩放
label_width = 500
label_height = 260
 
base_path = os.path.dirname(os.path.abspath(__file__))
# 加载原始图片
# original_image = Image.open("static/img/a.jpg")
original_image =  Image.open(os.path.join(base_path, Path('static') / 'img' / 'a.jpg'))
 
# 调整图片大小以适应 Label
# resized_image = resize_image(original_image, label_width, label_height)
# photo = ImageTk.PhotoImage(resized_image)
photo = ImageTk.PhotoImage(original_image)
 
# 创建 Label 并设置初始图片
label = tk.Label(root, text="头像", compound="bottom", font=("Arial", 14), image=photo, width=label_width,
                 height=label_height)
label.pack(padx=20, pady=20)
 
root.mainloop() # 保持窗口运行